﻿using System;
using System.Collections.Generic;
using System.Text;
using Com.Guocz.Media.FileSystem;

namespace BVision
{
    class Model
    {
        public IFileSystem FS
        {
            get;
            set;
        }
        public Path Root
        {
            get
            {
                return FS != null ? FS.Root : null;
            }
        }

        private Path currentDir;
        public Path CurrentDir
        {
            get
            {
                if (currentFile != null)
                {
                    return currentFile.Father;
                }
                if (currentDir == null)
                {
                    return Root;
                }
                return currentDir;
            }
            set
            {
                currentDir = value;
            }
        }

        private Path currentFile;
        public Path CurrentFile
        {
            get 
            {
                if (currentFile == null && currentDir != null)
                {
                    return currentDir.FirstFile;
                }
                return currentFile;
            }
            set
            {
                currentFile = value;
            }
        }
    }
}
